// [[ OnflowGenerator File UUID: 14977a0293c844159d5904dc755029fa  ]]
package com.itdct.onflow.system.role.controller

import com.itdct.onflow.core.type.*
import com.itdct.onflow.core.vo.KeyLabelValueVo
import com.itdct.onflow.core.vo.RespPageVo
import com.itdct.onflow.core.vo.RespVo
import com.itdct.onflow.system.common.base.BaseSysController
import com.itdct.onflow.system.role.qo.SysRoleAccountEditQo
import com.itdct.onflow.system.role.qo.SysRoleAccountSearchQo
import com.itdct.onflow.system.role.service.SysRoleAccountService
import com.itdct.onflow.system.role.vo.SysRoleAccountDetailVo
import com.itdct.onflow.system.role.vo.SysRoleAccountListVo
import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.tags.Tag
import org.springframework.http.MediaType
import org.springframework.validation.annotation.Validated
import org.springframework.web.bind.annotation.*

/**
 * @author DCTANT
 * @date 2025-09-03 15:53:01
 * @version 1.0
 * @description 角色账号关联接口控制
 */
@Tag(name = SysRoleAccountController.moduleName)
@RestController
@RequestMapping(value = ["/sysRoleAccount"], produces = [MediaType.APPLICATION_JSON_VALUE], method = [RequestMethod.POST])
class SysRoleAccountController(
    val sysRoleAccountService: SysRoleAccountService
) : BaseSysController() {
    companion object {
        const val moduleName = "角色账号关联"
    }

    @Operation(summary = moduleName + "添加")
    @PostMapping("/add.adw")
    fun add(@RequestBody @Validated(Add::class) qo: SysRoleAccountEditQo): RespVo<Long> {
        return sysRoleAccountService.add(qo, getContext())
    }

    @Operation(summary = moduleName + "更新")
    @PostMapping("/update.adw")
    fun update(@RequestBody @Validated(Update::class) qo: SysRoleAccountEditQo): RespVo<Unit> {
        return sysRoleAccountService.update(qo, getContext())
    }

    @Operation(summary = moduleName + "删除")
    @PostMapping("/delete.adw")
    fun delete(@RequestBody @Validated(Delete::class) qo: SysRoleAccountEditQo): RespVo<Unit> {
        return sysRoleAccountService.delete(qo, getContext())
    }

    @Operation(summary = moduleName + "详情")
    @PostMapping("/detail.adw")
    fun detail(@RequestBody @Validated(Detail::class) qo: SysRoleAccountSearchQo): RespVo<SysRoleAccountDetailVo> {
        return sysRoleAccountService.detail(qo, getContext())
    }

    @Operation(summary = moduleName + "列表")
    @PostMapping("/page.adw")
    fun page(@RequestBody @Validated(Page::class) qo: SysRoleAccountSearchQo): RespPageVo<SysRoleAccountListVo> {
        return sysRoleAccountService.page(qo, getContext())
    }

    // [[ OnflowGenerator Range (- selectFunctions -) Start ]]
    @Operation(summary = moduleName + "角色id下拉选")
    @PostMapping("/selectRoleIdList.adw")
    fun selectRoleIdList(@RequestBody qo: SysRoleAccountSearchQo): RespVo<List<KeyLabelValueVo>> {
        return sysRoleAccountService.selectRoleIdList(qo, getContext())
    }

    @Operation(summary = moduleName + "账号id下拉选")
    @PostMapping("/selectAccountIdList.adw")
    fun selectAccountIdList(@RequestBody qo: SysRoleAccountSearchQo): RespVo<List<KeyLabelValueVo>> {
        return sysRoleAccountService.selectAccountIdList(qo, getContext())
    }

// [[ OnflowGenerator Range (- selectFunctions -) End ]]
}